package org.android.kumoh_ing;

import java.util.List;
import java.util.StringTokenizer;

import android.graphics.drawable.Drawable;
import android.os.Bundle;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

/**
 * Map and overlays displaying current location
 *
 * @author Mike
 */
public class GoogleMap_ingActivity extends MapActivity {
	private List<Overlay> mapOverlays;
    private Drawable drawable;
    private ItemOverlay itemizedOverlay;
    private MapView mapView;
    private MapController mc;
    private String curLoc ="";
	private double latitude,longitude;
    
   @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

   /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mapview);
        mapView = (MapView)findViewById(R.id.map);
        curLoc = getIntent().getExtras().getString("curLocation");
        double intLatitude,intLongitude;
       
        StringTokenizer st = new StringTokenizer(curLoc, "$");
		String lat = st.nextToken();
		latitude = Double.parseDouble(lat);
		String lon = st.nextToken();
		longitude = Double.parseDouble(lon);

        
        mapView.setBuiltInZoomControls(true);
        mapView.setSatellite(false);

        mc = mapView.getController();
        intLatitude = latitude * 1000000;
		intLongitude = longitude * 1000000;
		
        mc.animateTo(new GeoPoint((int)intLatitude,(int)intLongitude));
        mc.setZoom(17);
        
        mapOverlays = mapView.getOverlays();
        drawable = this.getResources().getDrawable(R.drawable.marker);
        itemizedOverlay = new ItemOverlay(drawable, this);
       
        OverlayItem overlayitem1 = new OverlayItem(new GeoPoint((int)intLatitude,(int)intLongitude), "위치","요기");
        itemizedOverlay.addOverlay(overlayitem1);
       
        mapOverlays.add(itemizedOverlay);
    }


}



 


